#ifndef FRIENDAPPLYLIB_H
#define FRIENDAPPLYLIB_H

#include <QObject>
#include <QList>
#include <QPair>
#include <QSet>
#include "AbstractLayer/Database/databaseclass.h"

class FriendApplyLib : public QObject
{
    Q_OBJECT
public:
    static FriendApplyLib* getInstance();
    void addApply(const QString& friendoc,const QString& friendname,const EnumLib::ApplyStatus status);
    void setApply(const QString& friendoc,const EnumLib::ApplyStatus status);
    bool isEmpty();
    QList<QPair<QPair<QString,QString>,uint8_t>> getList();
    void clearLib();
    bool friendIsUnderrview(const QString& friendoc);
    void resetNewCount();
    int getNewApplyCount();
public slots:
    void recvFrendApplyList(const QList<QPair<QPair<QString,QString>,uint8_t>>& result);
signals:
    void s_loadFriendApplyDone();
    void s_haveNewApply(const QString &friendoc, const QString &friendname);
    void s_applyStatusChanged(const QString& friendoc,const EnumLib::ApplyStatus status);
private:
    FriendApplyLib();
    static FriendApplyLib* friendapply;
    QList<QPair<QPair<QString,QString>,uint8_t>> applylist;
    QSet<QString> ocset;
    int newapplycount;
};

#endif // FRIENDAPPLYLIB_H
